using System;
using System.Collections.Generic;
using System.Text;

using Irrlicht.Scene;
using Irrlicht;
using Irrlicht.Core;

namespace Mud.Client.WinApplication.Graphics
{
    public abstract class Model
    {
        /// <summary>
        /// When the model is added to the scene then it has a node.
        /// </summary>
        public ISceneNode Node
        {
            get { return _node; }
            protected set { _node = value; }
        }
        private ISceneNode _node;

        /// <summary>
        /// Irrlich device.
        /// </summary>
        public IrrlichtDevice Device
        {
            get { return _device; }
        }
        private IrrlichtDevice _device;


        public Model(IrrlichtDevice device)
        {
            _device = device;
        }


        public abstract void AddToScene();

        public virtual void RemoveFromScene()
        {
            if (_node == null)
                throw new InvalidOperationException("This model was neve added to the scene.");
            Node.Remove();
        }

    }
}
